<!DOCTYPE html>
<html>
<script Language="JavaScript">
    function a(number){
        var count = document.getElementById("count").value;
        for(var i=0; i<100; i++){
            var xmlHttp = new XMLHttpRequest();
            xmlHttp.open("get", "/MyDate?id="+number+"&count="+count , true);
            xmlHttp.send();
            xmlHttp.onreadystatechange = function(){
                document.getElementById("div_"+number).innerHTML = xmlHttp.responseText;
            }
        }

    }
    function b(number){
        var xmlHttp = new XMLHttpRequest();

        xmlHttp.open("get", "/MyDate?id="+number , true);
        xmlHttp.send();
        xmlHttp.onreadystatechange = function(){
            document.getElementById("div_"+number).innerHTML = xmlHttp.responseText;
        }
    }
    function bClear(number){
        document.getElementById("div_"+number).innerHTML = "";
    }
</script>
<head lang="en">
    <meta charset="UTF-8">
    <title>测试servlet中的时间函数</title>
</head>
<body>
<h2>dservlet date的应用和测试</h2>
<div>
    <div >
        <!--<leble>登录</leble><br/>-->
        <div id="div_login"><input type="button" value="点了变成登陆框" onclick="b('login')"/></div>
        <div><nobr><input  type="button" value="清除" onclick="bClear('login')"/></nobr></div>
        <!--<div id="div_login"><nobr></nobr></div>-->
    </div>
    <div >
        <leble>data.getTime()</leble><br/>
        <input  type="button" value="点下看看结果" onclick="b('1')"/>
        <input  type="button" value="清除" onclick="bClear('1')"/>
        <div id="div_1"><nobr></nobr></div>
    </div>

    <div >
        <leble>date.toString()</leble><br/>
        <input  type="button" value="点下看看结果" onclick="b('2')"/>
        <input  type="button" value="清除" onclick="bClear('2')"/>
        <div id="div_2" nowrap> </div>
    </div>

    <div>
        <leble>servlet中获得项目绝对路径. this.getServletConfig().getServletContext().getRealPath("/");</leble><br/>
        <input type="button" value="点下看看结果" onclick="b('3')"/>
        <input  type="button" value="清除" onclick="bClear('3')"/>
        <div id="div_3"> </div>
    </div>

    <div>
        <leble>根目录所对应的绝对路径:request.getServletPath();</leble><br/>
        <input type="button" value="点下看看结果" onclick="b('4')"/>
        <input  type="button" value="清除" onclick="bClear('4')"/>
        <div id="div_4"> </div>
    </div>

    <div>
        <leble>文件的绝对路径 :request.getSession().getServletContext().getRealPath(request.getRequestURI())</leble><br/>
        <input type="button" value="点下看看结果" onclick="b('5')"/>
        <input  type="button" value="清除" onclick="bClear('5')"/>
        <div id="div_5"> </div>
    </div>

    <div>
        <leble>getServletInfo</leble><br/>
        <input type="button" value="点下看看结果" onclick="b('6')"/>
        <input  type="button" value="清除" onclick="bClear('6')"/>
        <div id="div_6"> </div>
    </div>

    <div>
        <leble>System.currentTimeMillis()</leble><br/>
        <input type="button" value="点下看看结果" onclick="b('7')"/>
        <input  type="button" value="清除" onclick="bClear('7')"/>
        <div id="div_7"> </div>
    </div>

    <div>
        <leble>执行</leble>
        <input id="count" type="text" value="" style="width: 100px;"/>
        <leble>次++ 并获得getTime的毫秒数的执行时间</leble>
        <input type="button" value="点下看看" onclick="a('8')"/>
        <input  type="button" value="清除" onclick="bClear('8')"/>
        <div id="div_8"> </div>
    </div>
    <div>
        <h2>格式化输入样例</h2>
        <leble>SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd hh:mm:ss");
            Date dnow = new Date();</leble><br/>
        <input type="button" value="点下看看" onclick="b(9)"/>
        <input  type="button" value="清除" onclick="bClear('9')"/>
        <div id="div_9"> </div>
    </div>

</div>


</body>
</html>